<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>main</title>
<%@include file="/view/common/js-css.jsp"%>
</head>

<body>
	<div id="frameWrapper" class="frameWrapper">
		<div class="titlebar">
			<p>当前位置：个人中心<span>/</span>个人信息维护</p>
		</div>
		${search.student_name } &nbsp;&nbsp;${search.student_sno }
		<div id="table-wrap">
			<table border="1">
				<!--检索-->
				<thead>
					<tr>
						<th>学生学号</th>
						<th>姓名</th>
						<th>性别</th>
						<th>电话</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td>
							<div class="form_control" style="margin: 0 auto;">
								<input class="required" value="${search.student_sno }"
									type="text" id="studentno" readonly="readonly" />
							</div>
						</td>
						<%-- ${search.student_sno } --%>
						<td>${search.student_name }</td>
						<%-- ${search.student_phone } --%>
						<td>${search.student_sex }</td>
						<td>
							<div class="form_control" style="margin: 0 auto;">
								<input class="required" value="${search.student_phone }"
									type="text" id="studentphone" data-valid="isMobile"
									data-error="号码输出错误" />
							</div> <font color="red"><span id="ajaxStatus"></span></font>
						</td>
						<td>
							<div>
								<input class="btn btn-default" type="button" value="修改"
									onclick="changeTelephone();" />
							</div>
						</td>

					</tr>

				</tbody>
			</table>
		</div>
	</div>
</body>
<script type="text/javascript">
	function changeTelephone() {
		var stuno = document.getElementById("studentno").value;
		var stuphone = document.getElementById("studentphone").value;
		console.log(stuno + "tel:" + stuphone);
		htmlobj = $.ajax({
			url : getContextPath() + "/StudentServlet?command=ajaxchange"
					+ "&stuno=" + stuno + "&stuphone=" + stuphone,
			async : false
		});
		console.log(htmlobj.responseText);
		// 修改 提交状态 ajaxStatus
		var ajaxStatus = document.getElementById("ajaxStatus");
		ajaxStatus.innerHTML = htmlobj.responseText;
	}

	function getContextPath() {
		var pathName = document.location.pathname;
		var index = pathName.substr(1).indexOf("/");
		var result = pathName.substr(0, index + 1);
		return result;
	}
</script>
</html>